﻿<%@ Page Language="VB" AutoEventWireup="true" CodeFile="SpecialTickets.aspx.vb" Inherits="TheatreStaff_SpecialTickets" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<%@ Import Namespace="System.Web.Configuration" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">

</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<script type="text/javascript">
        
        function displayCalendar()
        {
            var datePicker = document.getElementById('datePicker');
            datePicker.style.display = 'block';
        }
        function showInsert() {
            var divInsert = document.getElementById('divInsert');
            divInsert.style.display = 'block';
        }
  
</script>
<script type="text/javascript">
function showInsert() {
    var divInsert = document.getElementById('divInsert');
    divInsert.style.display = 'block';
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
</script>
 <style type="text/css">
        #datePicker
        {
            display:none;
            position:absolute;
            border:solid 2px black;
            background-color:white;
           
        }
    
    </style>
<style type="text/css">
    .selectedRow
{
    background-color:Gray;
}
.center1
{
    padding-left:320px;
}
html
{
  background-image:url('image/back.jpg'); 

    padding:10px;
    color:White;    
  
}
.content1
{
    margin:auto;
    width:850px;
}
.column
{
    float:left;
    width:348px;
}
.selectedRow
{
    background-color:Gray;
}
.content
{
    width:950px;
    margin:auto;
        height: 197px;
    }

.link
{
  margin-left:350px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
.link2
{
  margin-left:50px; 
     font-weight:bold;
  font-size:large;  
    font-size:x-large;
}
a
{
 color: white;
 text-decoration:underline;
 font-weight:bold;

}
a:hover
{
 color: red; 
  text-decoration:none;
  font-weight:bold;

}
.join
{
   background-color:#0099FF;
  clip:auto;
  font-weight:bold;
  font-size:large;
}
.table2
{
 border-style:solid;
   border-color:Black;
   background-color:White;
   color:Black;  
   width:900px; 
}
.row
{
   background-color:Gray;
   color:White;
}
.ticket
{
   background-color:#CC0000;
color:White;

}

.ticket:hover
{
 color: black; 
  text-decoration:none;


}
    .style1
    {
        width: 509px;
    }
    
.footer
{

     font-weight:bold;
  font-size:large;  

}
.ticket1
{
    padding-left:200px;
}
.view2
{
 padding-left:180px;  
}
.text
{
 font-weight:bold;
}
.button
{
 margin-left:250px;
}
.view3
{
    padding-left:120px;
}
.footer
{

   margin-top:250px;
}
.center
{
    padding-left:280px;
}
.cinema
{
    padding-left:590px;
}
     .menu
{
 padding-left:150px;  

}
</style>
    <title>Special Ticket Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div class="content">
 <asp:Image ID="Image1" Width="1000" Height="130" ImageUrl="~/image/tdk-jun5-bannerbatmanexclusivo2.jpg" runat="server" /><br />
<asp:HyperLink ID="HyperLink14"  CssClass="link" NavigateUrl="~/Default.aspx" runat="server">Home</asp:HyperLink>
<asp:HyperLink ID="HyperLink1"  CssClass="link2" NavigateUrl="~/Session.aspx" runat="server">Session</asp:HyperLink> <asp:HyperLink ID="HyperLink2" CssClass="link2" NavigateUrl="~/Movie.aspx" runat="server">Movies</asp:HyperLink>
<asp:HyperLink ID="HyperLink3" CssClass="link2"  NavigateUrl="~/Price.aspx" runat="server">Prices</asp:HyperLink>


 <br /> <br />
  <%-- <asp:Label ID="Label5" runat="server"  Text="Theatre" CssClass="cinema" Font-Bold="True" Font-Underline="True"></asp:Label>
        <asp:Label ID="Label4" runat="server"  ForeColor="Yellow"></asp:Label>
      
&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp 
          <asp:Label ID="Label3" runat="server" Text="UserName" Font-Bold="True"></asp:Label>    <asp:LoginName ID="LoginName1" runat="server" /> 
    &nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp<asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="#99CCFF" />--%>
<table class="center1" >
        <tr>
            <td>
               <asp:Label ID="Label22222" runat="server"  CssClass="menu" Text="Theatre" Font-Bold="True" Font-Underline="True"></asp:Label>  
            </td>
            <td>
                 <asp:Label ID="Label4" runat="server"  ForeColor="Yellow"></asp:Label>
                 &nbsp;&nbsp;&nbsp;&nbsp;
            </td>
       <%-- </tr>
 </table> --%>
    <%--<td>&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp</td>--%>
<%--&nbsp;&nbsp;&nbsp;&nbsp&nbsp;&nbsp&nbsp;&nbsp&nbsp&nbsp;&nbsp &nbsp&nbsp;&nbsp --%>
  <%--<table align="center" >
        <tr>--%>
            <td>
                <asp:Label ID="Label12" runat="server" Text="UserName" Font-Bold="True"></asp:Label>
                &nbsp;&nbsp;
            </td>
            <td>
                <asp:LoginName ID="LoginName1" runat="server" /> 
                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
            <td>
                 <asp:LoginStatus ID="LoginStatus1" runat="server" ForeColor="#99CCFF" />
                 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            </td>
        </tr>
    </table>
        <hr />
  <asp:Label ID="Label8" runat="server" Text="Maintain:" Font-Bold="True" Font-Size="Larger" Font-Underline="True"></asp:Label>
<asp:HyperLink ID="HyperLink17" runat="server" 
            NavigateUrl="~/TheatreStaff/Cinema.aspx" ForeColor="#FFCC99">[Cinemas]</asp:HyperLink>&nbsp;&nbsp;
    <asp:HyperLink ID="HyperLink18" runat="server"  ForeColor="#FFFF99" NavigateUrl="~/TheatreStaff/Movies.aspx">[Movies]</asp:HyperLink> &nbsp;
    <asp:HyperLink ID="HyperLink144" runat="server" NavigateUrl="~/TheatreStaff/Schedule.aspx" ForeColor="#FF9900">[Schedules]</asp:HyperLink>&nbsp;  
 <asp:HyperLink ID="HyperLink117" runat="server" NavigateUrl="~/TheatreStaff/Session.aspx" ForeColor="#FF6699">[Session Times]</asp:HyperLink>&nbsp;  
  <asp:HyperLink ID="HyperLink116" runat="server" NavigateUrl="~/TheatreStaff/SessionDates.aspx" ForeColor="#66FF66">[Session Date]</asp:HyperLink>&nbsp;    
 <asp:HyperLink ID="HyperLink115" runat="server" NavigateUrl="~/TheatreStaff/SpecialTickets.aspx" ForeColor="Aqua">[Specail Price]</asp:HyperLink>&nbsp;
 <asp:HyperLink ID="HyperLink107" runat="server" NavigateUrl="~/TheatreStaff/specialday.aspx" ForeColor="#CCFF33">[Special Ticket Pricing Days]</asp:HyperLink>&nbsp;  
     <asp:HyperLink ID="HyperLink6" runat="server" NavigateUrl="~/TheatreStaff/SalesReports.aspx" ForeColor="#CCFFFF">[Sales Report]</asp:HyperLink>&nbsp; 
             <asp:HyperLink ID="HyperLink11" runat="server" NavigateUrl="~/TheatreStaff/AddNewUser.aspx" ForeColor="#66FF99">[Add New User]</asp:HyperLink>&nbsp; 
  <hr />

 <h3><asp:Label ID="Label2" Text ="Special Ticket Pricing Maintenance(FOR PARTICULAR SESSION TIME)"  runat="server"  CssClass="center" ForeColor="Aqua"/></h3> 
    <asp:BulletedList ID="BulletedList2"  CssClass="view2" ForeColor="white" runat="server">
               <asp:ListItem  Text="To mark a session time special click 'Select'->'Edit'"/>
               <asp:ListItem Text ="Change 'Session Type' to 'Special' and then click 'Update'" />
               
       
        </asp:BulletedList>
        <asp:ScriptManager ID="ScriptManager1" runat="server" />
        
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
        <div class ="content1">
         <%--<h2><asp:Label ID="Label54" Text ="Add New Cinema" runat="server" /></h2>--%>
         <table >
            <tr align ="center" >
                <td><h3><asp:Label ID="Label1" Text ="Special Price Management"  Visible="false" runat="server" /></h3></td>
            </tr>
            
         </table>
         <div class="column">
            <asp:GridView ID="grdSpecialTickets"
            AllowPaging="True" DataSourceID ="srcSpecial" DataKeyNames="datesessionid"
            AutoGenerateSelectButton ="True" SelectedRowStyle-CssClass="selectedRow" 
          AutoGenerateColumns ="False" runat="server" 
                 Height="360px" Width="16px">
                <Columns >
                    <%--<asp:BoundField DataField="sessionid" HeaderText ="Session Id" />--%>
                    <asp:BoundField DataField ="MovieTitle" HeaderText ="Movie Title"/>
                    <asp:BoundField DataField ="date" HeaderText ="Session Date" DataFormatString ="{0:d}" />
                    <asp:BoundField DataField ="time" HeaderText ="Session Time" DataFormatString ="{0:t}" />
                                   <asp:BoundField DataField ="sessiontype" HeaderText ="sessiontype" DataFormatString ="{0:t}" />
                </Columns>
            </asp:GridView>
           </div>
           <div class="column">
               <asp:DetailsView ID="dtlSpecial" OnItemUpdated ="OnItemUpdated_Click" 
               AutoGenerateEditButton ="true"    OnItemUpdating="function2"
               AutoGenerateRows ="false" runat="server" DataKeyNames ="datesessionid" DataSourceID ="srcSpecialSelect">
                <Fields >
                    <asp:TemplateField HeaderText ="Movie Title" HeaderStyle-Font-Bold="true" InsertVisible ="false">
                        <ItemTemplate>
                            <%# Eval("MovieTitle")%> 
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText ="Session Date" HeaderStyle-Font-Bold="true" InsertVisible ="false" >
                        <ItemTemplate>
                            <%# Eval("date","{0:d}")%> 
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText ="Session Time" HeaderStyle-Font-Bold="true" InsertVisible ="false" >
                        <ItemTemplate>
                            <%# Eval("time","{0:t}")%> 
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText ="Cinema" HeaderStyle-Font-Bold="true" InsertVisible ="false" >
                        <ItemTemplate>
                            <%# Eval("Cinema")%> 
                        </ItemTemplate>
                    </asp:TemplateField>
                   
                    <asp:TemplateField HeaderText ="Session Type" HeaderStyle-Font-Bold="true">
                        <ItemTemplate>
                            <%# Eval("sessiontype")%> 
                        </ItemTemplate>
                        <EditItemTemplate >
                            <asp:DropDownList 
                                    ID="ddlType" 
                                  
                                    
                                     runat="server"   >
                               <asp:ListItem Text="Normal" Value="Normal" />      
                                 <asp:ListItem Text="Special" Value="Special" />   
                          </asp:DropDownList>
                                 
                            
                                   
                                <asp:RequiredFieldValidator
                                    id="reqsessiontype"
                                    ControlToValidate="ddlType"
                                    InitialValue ="-1" 
                                    Text="(Required)"
                                    Runat="server" />
                        </EditItemTemplate>
                    </asp:TemplateField>
                  </Fields>
               </asp:DetailsView>
           </div> 
           </div>      
            <asp:Label ID="lblId" runat="server" Visible="false" ></asp:Label>
            <asp:SqlDataSource ID="srcSpecial" runat="server" 
            ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
            
            SelectCommand="SELECT datesession.datesessionid, datesession.date, datesession.sessionid, session2.time, Movie.MovieTitle, datesession.sessiontype FROM datesession INNER JOIN session2 ON datesession.sessionid = session2.sessionid INNER JOIN Cinema ON session2.cinema = Cinema.CinemaId INNER JOIN Movie ON datesession.movieid = Movie.MovieId INNER JOIN TheatreStaff ON Cinema.TheatreId = TheatreStaff.TheatreId WHERE (TheatreStaff.TheatreStaffUserName = @username) Order By  datesession.date">
            
                 <SelectParameters>
                  <asp:Parameter Name ="username" Type ="string"/> 
                 </SelectParameters>
            
            </asp:SqlDataSource>
            <asp:SqlDataSource ID="srcSpecialSelect"
                runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
                SelectCommand="SELECT  datesession.datesessionid,datesession.sessionid,session2.time, session2.Cinema, 
                datesession.date, datesession.ticketsold, 
                datesession.sessiontype, Movie.MovieTitle FROM session2 
                INNER JOIN datesession ON 
                session2.sessionid = datesession.sessionid INNER JOIN Movie ON 
                datesession.movieid = Movie.MovieId INNER JOIN Cinema ON 
                session2.Cinema = Cinema.CinemaId INNER JOIN TheatreStaff ON 
                Cinema.TheatreId = TheatreStaff.TheatreId WHERE
                (datesession.datesessionid=@datesessionid) "
                UpdateCommand ="UPDATE datesession SET sessiontype=@sessiontype
                WHERE datesessionid=@datesessionid ">
                
                 <SelectParameters>
                  <%--<asp:Parameter Name ="username" Type ="string"/> --%>
                  <asp:ControlParameter Name ="datesessionid" ControlID ="grdSpecialTickets" />
                </SelectParameters>
                <UpdateParameters >
                    <%--<asp:ControlParameter Name="sessiontype"  ControlID ="ddlType" 
                    PropertyName ="SelectedValue"/>--%>
                    <asp:Parameter Name="datesessionid" DbType ="Int32" />
                         <asp:Parameter Name="sessiontype"  />
                </UpdateParameters>
        
            </asp:SqlDataSource>

            
             <asp:SqlDataSource ID="srctype" runat="server" 
                  ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                  SelectCommand="SELECT DISTINCT type as sessiontype FROM TicketPrices">
        </asp:SqlDataSource>
            
  
            
  
 
  </ContentTemplate>
        </asp:UpdatePanel>
   <table align="left"  cellpadding="15" ><tr><td>Copyright@2012 MovieTix</td><td><asp:HyperLink ID="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  CssClass="footer" NavigateUrl="~/TheatreStaff/Session.aspx" runat="server">Session</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" NavigateUrl="~/TheatreStaff/Movies.aspx" runat="server">Movies</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  CssClass="footer" NavigateUrl="~/register.aspx" runat="server">Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  CssClass="footer" NavigateUrl="~/Login.aspx" runat="server">Log In</asp:HyperLink></td></tr></table>
<%--  <table align="left"  cellpadding="15" ><tr><td>Copyright@2012 MovieTix<asp:HyperLink="HyperLink8"  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server"> Homepage</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink9"  
  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Session </asp:HyperLink></td><td><asp:HyperLink ID="HyperLink10"  CssClass="footer" 
  NavigateUrl="~/Default.aspx" runat="server">Movies</asp:HyperLink>
  </td><td><asp:HyperLink ID="HyperLink11"  
  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Cinemas </asp:HyperLink></td><td><asp:HyperLink ID="HyperLink12"  
  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server"> Register</asp:HyperLink></td><td><asp:HyperLink ID="HyperLink13"  
  CssClass="footer" NavigateUrl="~/Default.aspx" runat="server">Log In </asp:HyperLink></td></tr></table>--%>
   </div>
</form>
</body>
</html>